#ifndef _WANGXUAN_DIRTY_LIST_H_
#define _WANGXUAN_DIRTY_LIST_H_

#include <list>
#include <vector>
using namespace std;

class Page;
typedef  list<Page*>::iterator DIRTYLISTPOS;

class DirtyList
{
	friend class Page;
public:
	static DirtyList* instance(){
		static DirtyList theList;
		return &theList;
	};
	~DirtyList();
	
	int update(Page* page);
	int remove(Page* page);

	unsigned int size();
	int flush();
	int flushAll();
private:
	DirtyList(){};
private:
	list<Page*> lp;
};

inline unsigned int DirtyList::size(){
	return lp.size();
}

#endif
